﻿var _ma__SendTo="";
var _ma__membernoname="";
var _ma__C0108="";
var _ma__SendNow="";
var _ma__C0022="";
var _ma__C0064="";
var _ma__C1006="";
var _ma__opmemberno="";
var _ma_error="";

function $Getmail$(ssmemberno) 
{
    showProgressBar(false,true);
    _ma__opmemberno=ssmemberno;
    WebServices.User.Public.GetMail(ssmemberno,$onsuccMail$);
}
function $onsuccMail$(result)
{
     showProgressBar(false,true);    
        _ma__membernoname = result[0];
        _ma__SendTo = result[1][0];
        _ma__C0108 = result[1][1];
        _ma__SendNow = result[1][2];
        _ma__C0022 = result[1][3];
        _ma__C0064 = result[1][4];
        _ma__C1006 = result[1][5];
        _ma_error=result[1][6];
         $("$divIput$").style.display = "none";         
       var smailText="<div id='$MaMessagesBox$'  style='display:none'><div class='MessagePanel4'><img  src='/images/ico_info.gif' style='border-width: 0px;'><div id='$maMessageText$'></div></div>";
        smailText=smailText+"</div><div style='padding:5px'><div class='margin10'><strong>"+_ma__SendTo+"</strong><br /><input type='text' class='common400'value='"+_ma__membernoname.replace(/\'/gi,"&#39")+"'/ ></div>";
	    smailText=smailText+"<div class='margin10'><strong>"+_ma__C0108+"</strong><br /><input type='textbox' id='_ma$subject$'class='common400' /></div><div class='margin10'><br />";
		smailText=smailText+"<textarea id=\"_ma$texta_body\" class='common400' rows=\"5\"></textarea>";
		smailText=smailText+"<div><input type='button'  class='button' value='"+_ma__SendNow+"' onclick='_ma__ShowMail()' /></div></div></div>";
		$ShowSampleBoxma$(smailText);
}
function $ShowSampleBoxma$(text)
{
     var obj={a:""}
    $ShowMessageBox$(_ma__C0022,text,null,null,450);
}

function _ma__ShowMail()
{
if($('_ma$subject$').value.replace(/\s+/gi,"").length<1||$("_ma$texta_body").value==""||$('_ma$subject$').value.length>140||$("_ma$texta_body").value.length>9999) 
{
    $('$maMessageText$').innerHTML=_ma_error;
    $("$MaMessagesBox$").style.display='';    
     return;
}
  WebServices.User.Public.WriteLetter(_ma__opmemberno,$("_ma$subject$").value,$('_ma$texta_body').value,$onsuccma$,_ma_onError);
}
function $onsuccma$(result)
{
 if(result)
 {
     $EndMessageBox$();
    WebServices.User.Public.MaSendmail(_ma__opmemberno);
 }
else
{
    $("$Message$").innerHTML = "<div><h3>"+_ma__C1006+"</h3><p style='text-align: center;'><input type='button' value='"+_ma__C0064+"' class='buttong' onclick='javascript:_ma_onError();' /></p></div>";
}
}
function _ma_onError()
{
     $EndMessageBox$();
}